Skip to content

Fix for NFS3 primary storage pool is failing to come out of maintenan…#71

Open
sandeeplocharla wants to merge 2 commits into
mainfrom
feature/CSTACKEX-146
Open

Fix for NFS3 primary storage pool is failing to come out of maintenan…#71
sandeeplocharla wants to merge 2 commits into
mainfrom
feature/CSTACKEX-146

Conversation

@sandeeplocharla

@sandeeplocharla sandeeplocharla commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Fix for NFS3 primary storage pool is failing to come out of maintenance mode

Description

This PR has the following:

  1. For NetworkFileSystem type, libvirtd handles mounting and unmounting of nfs mount [Ref: https://libvirt.org/storage.html]
  2. KVM adaptor hasn't overridden deleteStoragePool method leading to only just the change in the DB. This was leading to error in case of Cancel Maintenance as the pool already exists with the host.
  3. Also, when Enable Maintenance call comes, it was first removing the nfs mount, which was causing the libvirtd to error out during Destroy Pool call as the mount wasn't available.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [] Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Previously:

Screenshot 2026-07-08 at 8 00 05 AM Screenshot 2026-07-08 at 7 58 31 AM Screenshot 2026-07-08 at 8 00 29 AM Screenshot 2026-07-08 at 8 01 37 AM

So, clearly though the nfs mount was removed, the libvirtd still has the pool details with it.

Now:

Screenshot 2026-07-08 at 8 30 46 AM Screenshot 2026-07-08 at 8 31 18 AM Screenshot 2026-07-08 at 8 32 41 AM Screenshot 2026-07-08 at 8 33 02 AM Screenshot 2026-07-08 at 8 34 32 AM Screenshot 2026-07-08 at 8 33 46 AM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the KVM storage pool deletion flow to properly handle the deleteStoragePool(uuid, details) code path (notably for libvirt-backed pools), which previously could fall back to the StorageAdaptor default implementation and skip actual deletion.

Changes:

  • Added a LibvirtStorageAdaptor#deleteStoragePool(String, Map<String,String>) override to route to the existing libvirt deletion logic.
  • Adjusted KVMStoragePoolManager#deleteStoragePool(type, uuid, details) ordering around deletion vs HA monitor removal.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java Adds an overload so deletion with details actually invokes libvirt pool removal logic.
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java Changes when the adaptor delete call is executed relative to HA monitor removal for NFS pools.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 428 to 432
StorageAdaptor adaptor = getStorageAdaptor(type);
boolean deleteStatus = adaptor.deleteStoragePool(uuid, details);
if (type == StoragePoolType.NetworkFilesystem) {
_haMonitor.removeStoragePool(uuid);
}

public boolean deleteStoragePool(StoragePoolType type, String uuid, Map<String, String> details) {
StorageAdaptor adaptor = getStorageAdaptor(type);
boolean deleteStatus = adaptor.deleteStoragePool(uuid, details);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add brief comment about this change

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


public boolean deleteStoragePool(StoragePoolType type, String uuid, Map<String, String> details) {
StorageAdaptor adaptor = getStorageAdaptor(type);
boolean deleteStatus = adaptor.deleteStoragePool(uuid, details);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, update testing section

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@sandeeplocharla sandeeplocharla self-assigned this Jul 6, 2026
Copilot AI review requested due to automatic review settings July 8, 2026 03:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines +429 to 434
// For NetworkFilesystem, libvirt will take care of unmounting the nfs mount. If nfs mount has been removed before libvirt's pool
// delete, libvirt will throw an error. So, we need to remove the pool from HA monitor before deleting the pool.
boolean deleteStatus = adaptor.deleteStoragePool(uuid, details);
if (type == StoragePoolType.NetworkFilesystem) {
_haMonitor.removeStoragePool(uuid);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants